//
//  PokeStarView.swift
//  ToDo
//
//  Created by yanhangpu on 2021/7/22.
//

import SwiftUI

enum PokeStarViewActionType {
    case chart
    case info
    case star
}

enum PokeStarViewImgType: String {
    case chart = "chart.bar"
    case info = "info.circle"
    case star
}

struct PokeStarView: View {

    var item: PokeMasterItem
    
    var action:(PokeStarViewActionType) -> Void
   
    var body: some View {
        HStack {
            Spacer()
            Button(action: {
                action(.chart)
            }) {
                Image(systemName: PokeStarViewImgType.chart.rawValue)
                    .modifier(ToolButtonModifier())
            }
            Button(action: {
                action(.info)
            }) {
                Image(systemName: PokeStarViewImgType.info.rawValue)
                    .modifier(ToolButtonModifier())
            }
            
            Button(action: {
                action(.star)
            }) {
                Image(systemName: PokeStarViewImgType.star.rawValue)
                    .modifier(ToolButtonModifier())
            }
            .modifier(TrailingModifier())
        }
    }
}

struct PokeStarView_Previews: PreviewProvider {
    static var previews: some View {
        let pokeMasterData: [PokeMasterItem] = PokeMasterModel.loadPokeMasterData()
        PokeStarView(item: pokeMasterData[0]) { actionType in
            
        }
    }
}
